import com.sun.jna.Pointer;
import com.sun.jna.Structure;

import java.util.ArrayList;
import java.util.List;

public class CommunicationConfig extends Structure implements java.io.Serializable {

    public CommunicationConfig(Pointer p){
        super(p);
    }

    public byte[] ComputerName = new byte[16];

    public byte NetworkType;

    public int Baudrate;

    public byte Function;

    public byte Port;

    public byte Parity;

    public byte StopBits;

    public byte DataBits;

    public byte FlowControl;

    public byte DCProtocol;

    public byte FaxFlowControl;

    public short DSRTimeout;

    public short CTSTimeout;

    public byte[] InitString = new byte[256];

    public int AllowTempDevice;

    public int AllowAllDevice;

    public byte[] NetworkTarget = new byte[65];

    public int NetworkPort;

    public int RetryInterval;

    /**
     * Return this Structure's field names in their proper order.  For
     * example,
     * <pre><code>
     * protected List getFieldOrder() {
     *     return Arrays.asList(new String[] { ... });
     * }
     * </code></pre>
     * <strong>IMPORTANT</strong>
     * When deriving from an existing Structure subclass, ensure that
     * you augment the list provided by the superclass, e.g.
     * <pre><code>
     * protected List getFieldOrder() {
     *     List fields = new ArrayList(super.getFieldOrder());
     *     fields.addAll(Arrays.asList(new String[] { ... }));
     *     return fields;
     * }
     * </code></pre>
     * <p>
     * Field order must be explicitly indicated, since the
     * field order as returned by {@link Class#getFields()} is not
     * guaranteed to be predictable.
     *
     * @return ordered list of field names
     */
    @Override
    protected List getFieldOrder() {
        List a = new ArrayList();
        a.add("ComputerName");
        a.add("NetworkType");
        a.add("Baudrate");
        a.add("Function");
        a.add("Port");

        a.add("Parity");
        a.add("StopBits");
        a.add("DataBits");
        a.add("FlowControl");
        a.add("DCProtocol");

        a.add("FaxFlowControl");
        a.add("DSRTimeout");
        a.add("CTSTimeout");
        a.add("InitString");
        a.add("AllowTempDevice");

        a.add("AllowAllDevice");
        a.add("NetworkTarget");
        a.add("NetworkPort");
        a.add("RetryInterval");

        return a;
    }
}